const express = require('express')

const app = express()

const middleware = [
  (req, res, next) => {
    console.log(1);
    next()
  },
  (req, res, next) => {
    console.log(2);
    next()
  },
  (req, res) => {
    console.log(3);
    res.send('end middleware')
  }
]

app.use('/', middleware)  // 匹配路径 执行中间件 栈

app.listen(5000, () => {
  console.log('localhost:5000服务器已启动');
})